package com.thesis.controller;

import com.thesis.response.Result;
import com.thesis.service.UploadService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/upload")
public class UploadController {

    @Resource
    private UploadService uploadService;

    @PostMapping("/excel")
    public Result upload(@RequestParam(name = "file") MultipartFile multipartFile) throws IOException {
        return uploadService.upload(multipartFile);
    }

    @GetMapping("/insert")
    public Result insert(){
        return uploadService.insert();
    }

    @GetMapping("/download")
    public Result download(){
        return uploadService.download();
    }
}
